package com.woniu.api.order;

import com.woniu.common.entity.Order;
import com.woniu.common.entity.dto.PaymentNotification;
import com.woniu.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "order-service")
public interface OrderClient {

    @PostMapping("/api/orders")
    public Result addOrder(@RequestBody Order order);

    @GetMapping("/api/orders/userId/{userId}")
    public Result<List<Order>> getOrdersByUserId(
            @PathVariable("userId") Integer userId);

    @GetMapping("/api/orders/{id}")
    public Result<Order> getOrderById(@PathVariable("id") Integer id);

    // 新增：更新订单状态
    @PostMapping("/api/orders/update")
    Result<Void> updateOrderStatus(@RequestBody PaymentNotification paymentNotification);
}
